.class public Lcom/netease/newsreader/view/MyTabWidget;
.super Landroid/widget/TabWidget;
.source "MyTabWidget.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;
    }
.end annotation


# instance fields
.field private mAnimationView:Landroid/view/View;

.field private mAnimationViewCallback:Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;

.field private mCurrentIndex:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 34
    invoke-direct {p0, p1}, Landroid/widget/TabWidget;-><init>(Landroid/content/Context;)V

    .line 23
    const/4 v0, -0x1

    iput v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    .line 35
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 30
    invoke-direct {p0, p1, p2}, Landroid/widget/TabWidget;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 23
    const/4 v0, -0x1

    iput v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    .line 31
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 1
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 26
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/TabWidget;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 23
    const/4 v0, -0x1

    iput v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    .line 27
    return-void
.end method


# virtual methods
.method public dispatchDraw(Landroid/graphics/Canvas;)V
    .locals 3
    .parameter "canvas"

    .prologue
    .line 76
    iget v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    const/4 v1, -0x1

    if-eq v0, v1, :cond_0

    iget-object v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    if-eqz v0, :cond_0

    .line 77
    iget-object v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyTabWidget;->getDrawingTime()J

    move-result-wide v1

    invoke-virtual {p0, p1, v0, v1, v2}, Lcom/netease/newsreader/view/MyTabWidget;->drawChild(Landroid/graphics/Canvas;Landroid/view/View;J)Z

    .line 79
    :cond_0
    invoke-super {p0, p1}, Landroid/widget/TabWidget;->dispatchDraw(Landroid/graphics/Canvas;)V

    .line 80
    return-void
.end method

.method public getAnimationView()Landroid/view/View;
    .locals 1

    .prologue
    .line 112
    iget-object v0, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    return-object v0
.end method

.method protected onLayout(ZIIII)V
    .locals 6
    .parameter "changed"
    .parameter "left"
    .parameter "top"
    .parameter "right"
    .parameter "bottom"

    .prologue
    .line 40
    invoke-super/range {p0 .. p5}, Landroid/widget/TabWidget;->onLayout(ZIIII)V

    .line 42
    iget v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    const/4 v2, -0x1

    if-ne v1, v2, :cond_0

    .line 49
    :goto_0
    return-void

    .line 45
    :cond_0
    iget v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    invoke-virtual {p0, v1}, Lcom/netease/newsreader/view/MyTabWidget;->getChildTabViewAt(I)Landroid/view/View;

    move-result-object v0

    .line 46
    .local v0, currentTabView:Landroid/view/View;
    iget-object v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v0}, Landroid/view/View;->getLeft()I

    move-result v2

    .line 47
    invoke-virtual {v0}, Landroid/view/View;->getTop()I

    move-result v3

    invoke-virtual {v0}, Landroid/view/View;->getRight()I

    move-result v4

    .line 48
    invoke-virtual {v0}, Landroid/view/View;->getBottom()I

    move-result v5

    .line 46
    invoke-virtual {v1, v2, v3, v4, v5}, Landroid/view/View;->layout(IIII)V

    goto :goto_0
.end method

.method protected onMeasure(II)V
    .locals 4
    .parameter "widthMeasureSpec"
    .parameter "heightMeasureSpec"

    .prologue
    const/high16 v3, 0x4000

    .line 53
    invoke-super {p0, p1, p2}, Landroid/widget/TabWidget;->onMeasure(II)V

    .line 55
    iget v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    const/4 v2, -0x1

    if-ne v1, v2, :cond_1

    .line 72
    :cond_0
    :goto_0
    return-void

    .line 59
    :cond_1
    iget v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    invoke-virtual {p0, v1}, Lcom/netease/newsreader/view/MyTabWidget;->getChildTabViewAt(I)Landroid/view/View;

    move-result-object v0

    .line 60
    .local v0, currentTabView:Landroid/view/View;
    iget-object v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationViewCallback:Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;

    if-eqz v1, :cond_2

    .line 61
    iget-object v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationViewCallback:Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;

    .line 62
    iget-object v2, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    .line 61
    invoke-interface {v1, v0, v2}, Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;->onPrepareMeasure(Landroid/view/View;Landroid/view/View;)V

    .line 65
    :cond_2
    iget-object v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    if-eqz v1, :cond_0

    .line 67
    invoke-virtual {v0}, Landroid/view/View;->getMeasuredWidth()I

    move-result v1

    .line 66
    invoke-static {v1, v3}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result p1

    .line 69
    invoke-virtual {v0}, Landroid/view/View;->getMeasuredHeight()I

    move-result v1

    .line 68
    invoke-static {v1, v3}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result p2

    .line 70
    iget-object v1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v1, p1, p2}, Landroid/view/View;->measure(II)V

    goto :goto_0
.end method

.method public setAnimaitonView(Landroid/view/View;Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;)V
    .locals 0
    .parameter "view"
    .parameter "callback"

    .prologue
    .line 107
    iput-object p1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    .line 108
    iput-object p2, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationViewCallback:Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;

    .line 109
    return-void
.end method

.method public setCurrentTab(I)V
    .locals 6
    .parameter "index"

    .prologue
    const/4 v4, -0x1

    .line 84
    invoke-super {p0, p1}, Landroid/widget/TabWidget;->setCurrentTab(I)V

    .line 86
    const/4 v0, 0x0

    .line 87
    .local v0, animation:Landroid/view/animation/Animation;
    iget v2, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    .line 88
    .local v2, last:I
    if-eq v2, v4, :cond_0

    if-eq p1, v4, :cond_0

    if-eq p1, v2, :cond_0

    .line 89
    iget-object v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    if-eqz v3, :cond_0

    .line 90
    iget-object v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationViewCallback:Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;

    invoke-interface {v3, p1, v2}, Lcom/netease/newsreader/view/MyTabWidget$AnimationViewCallback;->createAnimation(II)Landroid/view/animation/Animation;

    move-result-object v0

    .line 92
    :cond_0
    iput p1, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    .line 94
    iget v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    if-eq v3, v4, :cond_1

    iget-object v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    if-eqz v3, :cond_1

    .line 95
    iget v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mCurrentIndex:I

    invoke-virtual {p0, v3}, Lcom/netease/newsreader/view/MyTabWidget;->getChildTabViewAt(I)Landroid/view/View;

    move-result-object v1

    .line 96
    .local v1, currentTabView:Landroid/view/View;
    iget-object v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v1}, Landroid/view/View;->getLeft()I

    move-result v4

    .line 97
    iget-object v5, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v5}, Landroid/view/View;->getLeft()I

    move-result v5

    sub-int/2addr v4, v5

    .line 96
    invoke-virtual {v3, v4}, Landroid/view/View;->offsetLeftAndRight(I)V

    .line 98
    iget-object v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v1}, Landroid/view/View;->getTop()I

    move-result v4

    .line 99
    iget-object v5, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v5}, Landroid/view/View;->getTop()I

    move-result v5

    sub-int/2addr v4, v5

    .line 98
    invoke-virtual {v3, v4}, Landroid/view/View;->offsetTopAndBottom(I)V

    .line 100
    if-eqz v0, :cond_1

    .line 101
    iget-object v3, p0, Lcom/netease/newsreader/view/MyTabWidget;->mAnimationView:Landroid/view/View;

    invoke-virtual {v3, v0}, Landroid/view/View;->startAnimation(Landroid/view/animation/Animation;)V

    .line 104
    .end local v1           #currentTabView:Landroid/view/View;
    :cond_1
    return-void
.end method
